#define  _CRT_SECURE_NO_WARNINGS
#include "code.h"

void QueueInit(Que* ps)
{
	assert(ps);
	ps->head=ps->tail=
}

void STDestory(ST* ps)
{
	assert(ps);
	free(ps->arr);
	ps->arr = NULL;
	ps->capacity = ps->top = 0;
}

void STpush(ST* ps, STDateType* x)
{
	assert(ps);

	if (ps->capacity == ps->top)
	{
		int newcapacity = ps->capacity == 0 ? 4 : ps->capacity * 2;
		STDateType* tmp= (STDateType*)realloc(ps->arr, sizeof(STDateType) * newcapacity);
		if (tmp == NULL)
		{
			perror("realloc");
		}
		ps->arr = tmp;
		ps->capacity = newcapacity;
	}
	ps->arr[ps->top] = x;
	ps->top++;
}


void STPop(ST* ps)
{
	assert(ps);
	assert(ps->top > 0);
	ps->top--;
}

int STSize(ST* ps)
{
	assert(ps);
	return ps->top;
}

bool STEmpty(ST* ps)
{
	assert(ps);
	return ps->top == 0;
}

STDateType STTop(ST* ps)
{
	assert(ps);
	assert(ps->top > 0);

	return ps->arr[ps->top - 1];
}
